package com.compass.doctor.ui.patient.adapter

import android.view.LayoutInflater
import android.view.ViewGroup
import com.compass.doctor.R
import com.compass.doctor.callback.OnCustomButtonClick
import com.compass.doctor.databinding.LayoutInquiryBriefItemBinding
import com.compass.doctor.databinding.LayoutInspectionItemBinding
import com.compass.framework.adapter.BaseBindViewHolder
import com.compass.framework.adapter.BaseRecyclerViewAdapter
import com.compass.framework.ext.onClick
import com.compass.framework.manager.DictionariesManager
import com.compass.framework.model.CreateInspection
import com.compass.framework.model.PatientISeeRecord
import com.compass.framework.utils.DateUtils
import com.compass.framework.utils.getColorFromResource

/**
 * Description：
 * Date:2024/3/28 10:33
 */
class InspectionListAdapter : BaseRecyclerViewAdapter<CreateInspection, LayoutInspectionItemBinding>() {


    private var onCustomBottomClick: OnCustomButtonClick? = null


    fun setCustomBottomClick(onCustomBottomClick: OnCustomButtonClick?) {
        this.onCustomBottomClick = onCustomBottomClick
    }


    override fun onBindDefViewHolder(
        holder: BaseBindViewHolder<LayoutInspectionItemBinding>,
        item: CreateInspection?,
        position: Int
    ) {
        if (item == null) return
        holder.binding.apply {
              tvDelete.onClick {
                  onCustomBottomClick?.onButtonCallBack(position,"delete")
              }
               if (item.type=="1"){
                   tvType.text="[检验]"
                   tvType.setTextColor(getColorFromResource(R.color.color_fe6897))
               }else{
                   tvType.text="[检查]"
                   tvType.setTextColor(getColorFromResource(R.color.color_5795ff))
               }
            tvInspectionName.text=item.inspectionName
            tvDepartment.text="执行科室：${item.departmentHisName}"

        }
    }

    override fun getViewBinding(
        layoutInflater: LayoutInflater,
        parent: ViewGroup,
        viewType: Int
    ): LayoutInspectionItemBinding {
        return LayoutInspectionItemBinding.inflate(layoutInflater, parent, false)
    }
}